/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.com.itcollege.BD;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author educacionit
 */
public abstract class ConectionMysql {


    public static Connection conectToMysql()  {
        
        Connection laConexion = null;
        
        try {
            String dbDriver = "com.mysql.jdbc.Driver";
            String dbConnString = "jdbc:mysql://localhost/javaweb";
            String dbUser = "root";
            String dbPassword = "";
            try {
                Class.forName(dbDriver).newInstance();
            } catch (ClassNotFoundException ex) {
                System.out.println(ex.getMessage().toString());
                //Logger.getLogger(ConectionMysql.class.getName()).log(Level.SEVERE, null, ex);
            }
            laConexion = DriverManager.getConnection(dbConnString, dbUser, dbPassword);
           
        } catch (InstantiationException ex) {
            System.out.println(ex.getMessage().toString());
            //Logger.getLogger(ConectionMysql.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            System.out.println(ex.getMessage().toString());
            //Logger.getLogger(ConectionMysql.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            System.out.println(ex.getMessage().toString());
            //Logger.getLogger(ConectionMysql.class.getName()).log(Level.SEVERE, null, ex);
        }

        return laConexion;
       

    }
}
